package com.smart.buss.ctrl;

import com.smart.buss.service.BussCodeService;
import com.smart.buss.vo.BussCode;
import com.smart.primary.common.common.BaseCtrl;
import com.smart.primary.common.util.AjaxResult;
import com.smart.primary.common.util.Util;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;

@RestController
@RequestMapping("/buss/code")
public class BussCodeController extends BaseCtrl {

	@Autowired
	private BussCodeService bussCodeService;

	@RequestMapping
	public AjaxResult getList(BussCode entity) throws Exception{
		List<BussCode> list=bussCodeService.queryListByPage(entity);
		return getResult(entity, list);
	}

	@RequestMapping("list")
	public List<BussCode> list(BussCode entity) throws Exception{
		return bussCodeService.queryList(entity);
	}

	@RequestMapping("/save")
	public AjaxResult save(BussCode entity) throws Exception{
		if(entity.getId()!=null){
			bussCodeService.insert(entity);
			return AjaxResult.updateSuccess();
		}else {
			bussCodeService.update(entity);
			return AjaxResult.saveSuccess();
		}
	}

}
